package org.hubwork.base.common;

public class ContextSupport{
   
  private static String dsContextName = DataSourceContext.class.getCanonicalName ();
  private static String sfContextName = SqlSessionFactoryKeyContext.class.getCanonicalName ();
  
  public static String getCurrentDataSource ()
  {
    return ThreadContext.get(dsContextName, DataSourceContext.class).getDataSourceName();
  }  
  public static void setCurrentDataSource (String dsName)
  {
    ThreadContext.get(dsContextName, DataSourceContext.class).setDataSourceName(dsName);
  }
  
  public static String getCurrentSqlSessionFactoryKey ()
  {
    return ThreadContext.get(sfContextName, SqlSessionFactoryKeyContext.class).getSqlSessionFactoryKeyName();
  }
  public static void setCurrentSqlSessionFactoryKey (String sfKeyName)
  {
    ThreadContext.get(sfContextName, SqlSessionFactoryKeyContext.class).setSqlSessionFactoryKeyName(sfKeyName);
  }
}
